function changeNum() {
	var cartNum = $api.getStorage("cartNum");
	var cartNumtxt = $api.byId('cartNum');

	if (cartNum) {

		if (cartNum != 0) {
			$api.css(cartNumtxt, 'display:block')
			$api.html(cartNumtxt, cartNum);
		} else {
			$api.css(cartNumtxt, 'display:none')
			$api.html(cartNumtxt, cartNum);
		}

	}
}

apiready = function() {

	headerstatus()
	getHeader();
	changeNum()
	

}
function getHeader() {
	var type = api.pageParam.type;
	var h1 = $api.byId("c-h1");
	switch(type) {
		case 'all':

			$api.text(h1, '所有商品');
			openDetailframe("all");
			/*getData("all",true);*/

			break;
		case 'ten':
			$api.text(h1, '十元专区');
			openDetailframe("ten");
			/*getData("ten",true);*/
			break;
		case 'pc':
			$api.text(h1, '电脑相机');
			openDetailframe("pc");
			/*getData("ten",true);*/
			break;
		case 'mobile':
			$api.text(h1, '手机平板');
			openDetailframe("mobile");
			/*getData("ten",true);*/
			break;
		case 'apple':
			$api.text(h1, '苹果专区');
			openDetailframe("apple");
			/*getData("ten",true);*/
			break;
		case '50':
			$api.text(h1, '潮流新品');
			openDetailframe("50");
			/*getData("50",true);*/
			break;
		case '13':
			$api.text(h1, '家电汽车');
			openDetailframe("13");
			/*getData("13",true);*/
			break;
		case '6':
			$api.text(h1, '化妆个护');
			openDetailframe("6");
			/*getData("6",true);*/
			break;
		case '20':
			$api.text(h1, '钟表首饰');
			openDetailframe("20");
			/*getData("20",true)*/
			break;
		case '55':
			$api.text(h1, '奢侈品');
			openDetailframe("55");
			/*getData("55",true)*/
			break;
		case '56':
			$api.text(h1, '其他产品');
			openDetailframe("56");
			/*getData("56",true)*/
			break;

	}

}

function openDetailframe(type) {
	var width = api.winWidth;
	var header = $api.byId('header');
	var headerPos = $api.offset(header);

	var height = api.winHeight - headerPos.h;

	api.openFrame({
		name : 'classifyList',
		url : './classifyList.html',
		rect : {
			x : 0,
			y : headerPos.h,
			w : width,
			h : height
		},
		pageParam : {
			type : type
		},
		customRefreshHeader: 'UIPullRefresh'

	});
}

